package dcsinstnce.server.lifecyclemanager;

import dcsinstnce.server.lifecyclemanager.impl.CacheInformatiqueImpl;
import dcsinstnce.server.topic.impl.TopicImpl;

public class CacheLifeCycleManagerListenerImpl implements CacheLifeCycleManagerListener{

	private static CacheLifeCycleManagerListenerImpl cachelifemanager = null; 
	private CacheInformatiqueImpl cacheInfo = null;
	
	private CacheLifeCycleManagerListenerImpl(){
		cacheInfo = new CacheInformatiqueImpl();
	}
	
	public static CacheLifeCycleManagerListenerImpl getInstance(){
		if(cachelifemanager == null)
			cachelifemanager = new CacheLifeCycleManagerListenerImpl();
		return cachelifemanager;
	}
	
	@Override
	public void notifyCacheCreation(TopicImpl topic, String id) {
		cacheInfo.addEntry(topic, id);
	}

	@Override
	public void notifyCacheDelete(TopicImpl topic, String id) {
		cacheInfo.deleteEntry(topic);
	}

}
